﻿using System;

namespace diantou.web.include
{
    /// <summary>
    /// 修改回答
    /// </summary>
    /// <typeparam name="viewType"></typeparam>
    abstract class reworkAnswer<viewType> : currentUserView<viewType>
        where viewType : reworkAnswer<viewType>
    {
        /// <summary>
        /// 回答
        /// </summary>
        protected answer.userAnswer answer;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        protected void onAnswer(fastCSharp.net.returnValue<diantou.dataAccess.answer> value)
        {
            answer = new answer.userAnswer { Answer = value.Value, UserId = currentUser.Id };
            callback();
        }
        /// <summary>
        /// 
        /// </summary>
        protected override void clear()
        {
            base.clear();
            answer.Answer = null;
        }
    }
    /// <summary>
    /// 修改回答
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPage = false, IsPool = true, QueryName = null)]
    partial class reworkAnswer : reworkAnswer<reworkAnswer>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="answser"></param>
        /// <returns></returns>
        private bool loadView(diantou.dataAccess.answer value)
        {
            value.UserId = currentUser.Id;
            setAsynchronous();
            diantou.dataAccess.tcpCall.answer.rework(value, onAnswer);
            return true;
        }
    }
}
